p2m: Allow non-leaf entries to be replaced by leaf entries
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Fri, 21 Jan 2011 15:37:36 +0000 (15:37 +0000)
committerGeorge Dunlap <george.dunlap@eu.citrix.com>
Fri, 21 Jan 2011 15:37:36 +0000 (15:37 +0000)
commitcf956b11ce576b4f54dbf2ca3f11717c0960431d
tree19a4a2bc29b996724e1271124f7ab56d087491d4
parentc856ec5f96dd41e1d23528f6051ae6c29f49c716
p2m: Allow non-leaf entries to be replaced by leaf entries

Allow l2 and l3 p2m tables to be replaced with 2MB and 1GB pages
respectively, freeing the p2m table page properly.  This allows, for example,
a sequence of 512 singleton zero pages to be replaced with a superpage
populate-on-demand entry.

Changes:
* Add a p2m_free_ptp() corresponding to p2m_alloc_ptp(), which will
handle everything related to the freeing properly.
* Add p2m_free_entry(), based on ept_free_entry(), which will free
intermediate tables recursively.
* For both ept and p2m, when replacing non-leaf entries with leaf
entries, keep old entry and call *_free_entry() after new entry
has been written and proper flushes have been done.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
xen/arch/x86/mm/hap/hap.c
xen/arch/x86/mm/hap/p2m-ept.c
xen/arch/x86/mm/p2m.c
xen/include/asm-x86/p2m.h